<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var i =prompt('输入计算阶乘')
        if(i<0){
            console.log('不得是负数')
        }
        else if(i==0){
            console.log('1')
        }
        else{
            let y = 1 ;
            for(let x=i;x>=1;x--){
                y *=x
            }
            console.log(y)
        }
       
         
    </script>
</head>
<body>
    
</body>
</html>